package day017.stream;

import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.function.Consumer;

public class StreamDemo4 {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();
        list.add("张无忌");
        list.add("张翠山");
        list.add("张三丰");
        list.add("谢广坤");

        long count = list.stream().count();
        System.out.println(count);
    }

    private static void method1(ArrayList<String> list) {
        list.stream().forEach(new Consumer<String>() {
            @Override
            public void accept(String s) {
                System.out.println(s);
            }
        });

        System.out.println("=============================");

        list.stream().forEach((String s) -> {
            System.out.println(s);
        });

        System.out.println("==============================");
        list.stream().forEach(s -> System.out.println(s));
    }
}
